package com.example.demo.service;

import com.example.demo.entity.User;
import com.example.demo.service.redis.RedisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

/**
 * 赵海波 on 2017/6/23.
 */
@Service
public class DemoService {


    @Autowired
    public RedisService redisService;




    public  void add(String key,User user){
        //放入缓存
        redisService.setObject(key,user);
    }




    public  void delete(String key){
        //放入缓存
        redisService.delete(key);
    }
    public  void update(String key,User user){
        //放入缓存
        redisService.setObject(key,user);
    }


    public  User query(String key){
        //放入缓存
        User user = (User) redisService.getObject(key);
        return  user;
    }




}
